package org.hxzon.workeasy.pages.user;

import java.util.List;

import org.apache.tapestry5.EventConstants;
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SetupRender;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.hxzon.workeasy.model.EasyUzer;
import org.hxzon.workeasy.pages.base.MyBasePage;
import org.hxzon.workeasy.permissions.UserViewPermissions;
import org.hxzon.workeasy.service.EasyUserService;

public class ListUser extends MyBasePage {
    @Inject
    private EasyUserService userSer;

    @Property
    private List<EasyUzer> list;

    @OnEvent(value = EventConstants.ACTIVATE)
    Object init() {
        new UserViewPermissions().check(null, getVisitor());
        return null;
    }

    @SetupRender
    Object display() {
        list = userSer.findAll();
        return null;
    }

}
